c[10];d[10];
f(int*a,int*b){return *a-*b;}
unsigned long s;
main(a,b,n,i,v)
{
	for(gets(&n);~scanf("%d%d%d",&a,&b,&n);printf("%.6lf\n",1.*s/(n-a-b)))
	{
		memset(c,0,40);
		memset(d,15,40);
		for(s=0,i=n;i--;s+=v)
		{
			scanf("%d",&v);
			*c=*c>v?*c:v;
			d[9]=d[9]<v?d[9]:v;
			qsort(c,10,4,f);
			qsort(d,10,4,f);
		}
		
		for(i=9;i>(9-a);)
			s-=c[i--];
		for(i=0;i<b;)
			s-=d[i++];
	}
}
